package com.anhua.controller;


import com.anhua.pojo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

@RestController
@Validated
@Slf4j
public class FormCheckController {

    @RequestMapping("/getChechUser")
//    简单校验
    public String getUserByUser(@NotNull(message = "不能为空") @RequestBody String id) {
        log.info("info");
        log.error("info");
        log.warn("info");
        log.trace("info");
        log.debug("info");
        return "处理成功1111";
    }

    //对象校验
    @GetMapping("/getChechUserById")
    public String getUserByUser(@Validated @RequestBody User user) {
        return "处成功";
    }
}
